require 'erb'
require 'common/base'

class DHCPBase < Base

  attr_accessor :step, :transport, :base_hosts, :base_options, :base_transports, :base_variables, :message

  def initialize(step, filename, params = {}, transport="DHCP")
    super()
    @transport = transport
    @step = step

    @base_hosts ='&host_0 = host(role: "client", description: "client/src", type: v4)
        &host_1 = host(role: "server", description: "server/dst", type: v4)
   '

    @base_options = ""

    @base_variables = ''

    @base_transports = 'DHCP = ethernet(src: &host_0, dst: &host_1, filter: "(ether dst src_mac or ether broadcast)")
        DHCP_UDP = udp(src: &host_0, dst: &host_1, src_port: 2067, dst_port: 68)'

    if !filename.nil?
      template = get_message("DHCP", filename)
      erb = ERB.new(template, 0, '%<>')
      @message = erb.result(binding)
    end
  end
end
